<?php
include("../../conection.php");


if (isset($_GET['add'])) {
    $class= $_GET['add'];
    $queryInsertClass = "INSERT INTO tbl_classes(cla_name) VALUES ('".$class."')";
    if (!mysql_query($queryInsertClass)) {
        die('Error: ' . mysql_error());
    }
    
    $query_select_class = "SELECT * FROM tbl_classes;";
    $resultClass = mysql_query($query_select_class) or die('select filter error');
    
    $className ='<select style="height: 24px; margin-top: 0px;">
                                <option value="">Please select...</option>';
                          
                                while ($class_row = mysql_fetch_array($resultClass)) {

                                   $className .="<option value='$class_row[cla_id]'>$class_row[cla_name] </option>";
                                }
                                
    $className.='</select>';
    echo $className;
}


?>

<!--
<div id="form_add_class">
    <form action="add_class.php">
        Class name:
        <input type="text" name="class_name" />
        <input type="submit" value="Add" name="btnSubmit" />
        <input type="button" value="Cancel" name="btnCancel" />
    </form>
</div>
-->